oxenstored: do not commit read-only transactions
authorThomas Sanders <thomas.sanders@citrix.com>
Fri, 24 Mar 2017 16:16:10 +0000 (16:16 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 28 Mar 2017 12:07:04 +0000 (13:07 +0100)
commitb2a4105820807beb85cfeeaf2dc3c8bb93cc6d0c
tree33cb984df9fc1592dbd8ad3c5d7cc1bf8ea74d75
parent467c9de412f2ba80dc40a82b049abefc7bf8126a
oxenstored: do not commit read-only transactions

The packet telling us to end the transaction has always carried an
argument telling us whether to commit.

If the transaction made no modifications to the tree, now we ignore
that argument and do not commit: it is just a waste of effort.

This makes read-only transactions immune to conflicts, and means that
we do not need to store any of their details in the history that is
used for assigning blame for conflicts.

We count a transaction as a read-only transaction only if it contains
no operations that modified the tree.

This means that (for example) a transaction that creates a new node
then deletes it would NOT count as read-only, even though it makes no
change overall. A more sophisticated algorithm could judge the
transaction based on comparison of its initial and final states, but
this would add complexity and computational cost.

Signed-off-by: Thomas Sanders <thomas.sanders@citrix.com>
Reviewed-by: Jonathan Davies <jonathan.davies@citrix.com>
tools/ocaml/xenstored/process.ml
tools/ocaml/xenstored/transaction.ml